package com.lfy.controller;

import com.lfy.Factor.comm.CaoFacotry;
import com.lfy.Factor.comm.abs.AbsFacotry;
import com.lfy.Factor.comm.abs.dfg.ghj;
import com.lfy.aop.TT;
import com.lfy.dao.UserMapper;
import com.lfy.domian.User;
import com.lfy.service.Crud;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestDomain {
    @Resource
    private Crud crud;
    @Resource
    private UserMapper userMapper;
    @GetMapping("/select")
    public User select(String id){
        User user = crud.selectUser(id);
        return user;
    }
    @PostMapping("/updatebyid")
    public int updateUserById(User user){
        int i = crud.updateUserById(user);
        return i;
    }
    @PostMapping("/delte")
    public int deleteByid(String  id){
        int i = crud.deleteUserById(id);
        return i;
    }
    @GetMapping("/ddd")
    @TT("#id")
    public String order(String id,String name ,String phone){
        return "OK";
    }
    @GetMapping("/dd")
    @TT()
    public String odd(String id,String name ,String phone){
        return "OK";
    }

    @GetMapping("/parse")
    public String string(){
        String parse = CaoFacotry.getInstance().parse(1);
        return parse;
    }
    @GetMapping("/abs")
    public String abs(){
        String parse = ghj.getInstance().parse(1);
        System.out.println(parse);
        System.out.println("============");
        String parse1 = ghj.getInstance().parse(2);
        System.out.println(parse1);
        return "ok";
    }
}
